Skip to content

remove stale dependency on "sure" #1227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

a-detiste
Copy link
Contributor

"sure" was a popular helper to "nose" ... a long time ago

@absurdfarce
Copy link
Collaborator

Good find @a-detiste! I've kicked off a Jenkins build just to confirm there aren't any unexpected regressions here but I'll be surprised if anything comes of it. Assuming there isn't a problem this should go in right away!

@absurdfarce
Copy link
Collaborator

Hey @a-detiste , unfortunately the Jenkins build detected a collection of new failures, most (or actually I think all?) in tests/integration/cqlengine/test_timestamp.py. That looks to be the only test that was using the "sure" module but apparently it was using it; when I run the integration test locally with your branch I get the following:

$ EVENT_LOOP_MANAGER="libev" CASSANDRA_VERSION="4.1.6" pytest -v tests/integration/cqlengine/test_timestamp.py

=========================================================================================== short test summary info ============================================================================================
FAILED tests/integration/cqlengine/test_timestamp.py::BatchTest::test_batch_is_included - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_batch - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_non_batch_syntax_integration - AttributeError: 'TestTimestampModel' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_non_batch_syntax_unit - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_non_batch_syntax_with_tll_integration - AttributeError: 'TestTimestampModel' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_non_batch_syntax_with_ttl_unit - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_timestamp_is_set_on_model_queryset - AttributeError: 'datetime.timedelta' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::CreateWithTimestampTest::test_timestamp_not_included_on_normal_create - AttributeError: 'str' object has no attribute 'shouldnt'
FAILED tests/integration/cqlengine/test_timestamp.py::UpdateWithTimestampTest::test_instance_update_in_batch - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::UpdateWithTimestampTest::test_instance_update_includes_timestamp_in_query - AttributeError: 'str' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::DeleteWithTimestampTest::test_blind_delete - AttributeError: 'TestTimestampModel' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::DeleteWithTimestampTest::test_blind_delete_with_datetime - AttributeError: 'TestTimestampModel' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::DeleteWithTimestampTest::test_delete_in_the_past - AttributeError: 'TestTimestampModel' object has no attribute 'should'
FAILED tests/integration/cqlengine/test_timestamp.py::DeleteWithTimestampTest::test_non_batch - AttributeError: 'TestTimestampModel' object has no attribute 'should'
====================================================================================== 14 failed, 124 warnings in 13.85s =======================================================================================

That "should" function appears to be part of the DSL provided by sure so if we're going to remove the dependency we'll need to replace all those usages with something else.

@a-detiste a-detiste reopened this Sep 30, 2024
@a-detiste
Copy link
Contributor Author

Indeed ... but it also means that nobody knows how sure works anymore.
Here's a new scaled-down PR for review.

@bschoening
Copy link
Contributor

bschoening commented Jun 23, 2025

@a-detiste shouldn't this use assertEqual() and assetIsNotNone() instead of raw operators?
import sure could also be removed?

@a-detiste
Copy link
Contributor Author

Here it is

import sure could also be removed?

There's a few more left to translate after this

        "USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
        query.should.match(r"INSERT.*USING TIMESTAMP")
        "USING TIMESTAMP".should.be.within(query)
        query.should.match(r"USING TTL \d* AND TIMESTAMP")
        "USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
        "USING TIMESTAMP".should.be.within(query)

@bschoening
Copy link
Contributor

@a-detiste if within is a substring match, assertIn() would be the unittest equivalent I believe.
assert re.match("\d+", value) should do the regex matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants